## Script (Python) "do_kerl_search"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=kerl
##title=
##
from Products.KnowledgeEngine.AssessmentFilter import AssessmentFilter
from Products.KnowledgeEngine.KERLProcessor import parseKERL

models = [x.getObject() for x in context.knowledgeengine_genericobjectcatalogservice(getClassName="Model")]

ass = context.knowledgeengine_assessmentstorageservice

user = context.knowledgeengine_userproviderservice.getUser( context.portal_membership.getAuthenticatedMember().getId() )

filter = AssessmentFilter('', parseKERL(kerl), models=models)

assessments = ass.getAssessmentsSatisfyingFilter( filter, user )

return assessments
